<template>
  <div class="analysis-card">
    <h3 class="analysis-title level-title">榜单</h3>
    <div class="rankings-grid">
      <div class="ranking-item">
        <span class="ranking-name">好评榜</span>
        <div class="ranking-value">
          <span class="ranking">{{ getData('星级榜单变化', '好评榜') }}</span>
        </div>
      </div>

      <div class="ranking-item">
        <span class="ranking-name">热销榜</span>
        <div class="ranking-value">
          <span class="ranking">{{ getData('星级榜单变化', '热销榜') }}</span>
        </div>
      </div>

      <div class="ranking-item">
        <span class="ranking-name">收藏榜</span>
        <div class="ranking-value">
          <span class="ranking">{{ getData('星级榜单变化', '收藏榜') }}</span>
        </div>
      </div>

      <div class="ranking-item">
        <span class="ranking-name">人气榜</span>
        <div class="ranking-value">
          <span class="ranking">{{ getData('星级榜单变化', '人气榜') }}</span>
        </div>
      </div>

      <div class="ranking-item">
        <span class="ranking-name">回头客榜</span>
        <div class="ranking-value">
          <span class="ranking">{{ getData('星级榜单变化', '回头客榜') }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import type { ReportSection } from '@/types/report'

interface Props {
  sectionData: ReportSection
}

const props = defineProps<Props>()

const getData = (section: string, key: string): string => {
  const item = props.sectionData.items.find(item => item.name === key)
  return item?.value || '-'
}
</script>

<style scoped>
.analysis-card {
  margin-bottom: 20px;
  padding: 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.level-title {
  font-size: 18px;
  color: #2d3748;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.rankings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.ranking-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  text-align: center;
}

.ranking-name {
  font-size: 14px;
  color: #4a5568;
}

.ranking {
  font-size: 24px;
  font-weight: 600;
  color: #2d3748;
}

@media (max-width: 768px) {
  .rankings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .rankings-grid {
    grid-template-columns: 1fr;
  }
}
</style> 